package com.xilihui.xlh.business.activitys;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.xilihui.xlh.R;
import com.xilihui.xlh.business.entities.HistoryEntity;
import com.xilihui.xlh.business.widget.CircleImageView;
import com.xilihui.xlh.constant.UrlConst;
import com.xilihui.xlh.core.app.BaseCompatActivity;
import com.xilihui.xlh.core.glide.ImageHelper;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/5/28.
 */

public class BookingDetailsActivity extends BaseCompatActivity {
    
    @BindView(R.id.civ_head)
    SimpleDraweeView civ_head;
    @BindView(R.id.tv_shopName)
    TextView tv_shopName;
    @BindView(R.id.iv_address)
    TextView tv_address;
    @BindView(R.id.tv_time)
    TextView tv_time;
    @BindView(R.id.tv_type)
    TextView tv_type;
    @BindView(R.id.tv_seat)
    TextView tv_seat;
    @BindView(R.id.tv_start_time)
    TextView tv_start;
    @BindView(R.id.tv_end_time)
    TextView tv_end;
    @BindView(R.id.tv_fukuang_time)
    TextView tv_fukuang;
    @BindView(R.id.tv_evaluation)
    TextView tv_evaluation;
    
    
    
    HistoryEntity.AppointBean appointBean;
    
    @OnClick(R.id.iv_back)
    public void back(){
        finish();
    }
    
    @Override
    public int getLayout() {
        return R.layout.activity_booking_details;
    }

    @Override
    public String initTitle() {
        return null;
    }

    @Override
    public void initUI(@Nullable Bundle savedInstanceState) {

    }

    @Override
    public void initData() {
        appointBean = (HistoryEntity.AppointBean) getIntent().getSerializableExtra("data");

        civ_head.setImageURI(UrlConst.baseUrl()+appointBean.getAgent().getHeadimg());

        tv_shopName.setText(appointBean.getAgent().getName());
        tv_address.setText(appointBean.getAgent().getAddress());
        tv_type.setText(appointBean.getHair_project().getName());
        tv_seat.setText(appointBean.getSeat().getName());
        tv_time.setText(appointBean.getStart_time()+"~"+appointBean.getEnd_time());
        tv_start.setText(appointBean.getCheck_start_time());
        tv_end.setText(appointBean.getCheck_end_time());
        tv_fukuang.setText(appointBean.getServer_account().getPay_time());
        
        if(appointBean.getComment_store().equals("1")){
            tv_evaluation.setVisibility(View.GONE);
        }else {
            tv_evaluation.setVisibility(View.VISIBLE);
        }
        
    }
    
    @OnClick(R.id.iv_phone)
    public void phone(){
        Intent intent = new Intent(Intent.ACTION_DIAL);
        Uri data = Uri.parse("tel:" +appointBean.getAgent().getPhone());
        intent.setData(data);
        startActivity(intent);
    }
    
    @OnClick(R.id.tv_service)
    public void service(){
        Intent intent = new Intent(Intent.ACTION_DIAL);
        Uri data = Uri.parse("tel:" +appointBean.getAgent().getKefu_tell());
        intent.setData(data);
        startActivity(intent);
    }
    
    @OnClick(R.id.tv_evaluation)
    public void evaluation(){
        Intent intent = new Intent(BookingDetailsActivity.this,EvaluationStoreActivity.class);
        intent.putExtra("data",appointBean);
        startActivity(intent);
        finish();
    }
    
    
    
}
